Skip to content

feat: add throttling to user invitation and login endpoints#1565

Merged
Artuomka merged 2 commits into
mainfrom
backend_security_report
Feb 5, 2026
Merged

feat: add throttling to user invitation and login endpoints#1565
Artuomka merged 2 commits into
mainfrom
backend_security_report

Conversation

@Artuomka

@Artuomka Artuomka commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings February 5, 2026 14:58
@Artuomka Artuomka enabled auto-merge February 5, 2026 15:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds rate limiting protection to critical authentication and user management endpoints to prevent abuse and brute-force attacks.

Changes:

  • Added throttling to the user login endpoint with a limit of 5 requests per minute (200 in test environment)
  • Added throttling to the user invitation endpoint with a limit of 10 requests per minute (200 in test environment)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
backend/src/entities/user/user.controller.ts Added imports for Throttle decorator and isTest helper, applied throttling to the login endpoint
backend/src/entities/company-info/company-info.controller.ts Applied throttling to the user invitation endpoint

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

description: 'Login successful.',
type: TokenExpDs,
})
@Throttle({ default: { limit: isTest() ? 200 : 5, ttl: 60000 } })

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OTP login endpoint (/user/otp/login/) performs authentication and issues tokens similar to the regular login endpoint, but it lacks throttling protection. This endpoint should also be throttled to prevent brute-force attacks on 2FA codes. Consider adding a throttle decorator similar to the regular login endpoint.

Copilot uses AI. Check for mistakes.
description: 'Login successful.',
type: TokenExpDs,
})
@Throttle({ default: { limit: isTest() ? 200 : 5, ttl: 60000 } })

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The password reset request endpoint (/user/password/reset/request/) can be abused to send spam emails to users. This endpoint should be throttled to prevent abuse. Consider adding a throttle decorator similar to other sensitive endpoints.

Copilot uses AI. Check for mistakes.
@Artuomka Artuomka merged commit a5e4c36 into main Feb 5, 2026
19 checks passed
@Artuomka Artuomka deleted the backend_security_report branch February 5, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants